//
//  Camera.h
//  SpaceStorm
//
//  Created by 祥 雍 on 13-6-15.
//  Copyright (c) 2013年 __MyCompanyName__. All rights reserved.
//

#import "Constants.h"
#import "cocos2d.h"

@protocol CameraDelegate <NSObject>

@optional
-(void) updateViewType:(BattleViewType)changeToType;
-(void) setViewpointCenter:(CGPoint)position;

@end

@interface Camera : CCNode <CameraDelegate>
{
    float _width;       //初始宽
    float _height;      //初始高
    float _x;           //初始x
    float _y;           //初始y
    
    float _curWidth;       //当前宽
    float _curHeight;      //当前高
    float _curX;           //当前x
    float _curY;           //当前y
    
    float _centerX;     //镜头的逻辑中心点X
    float _centerY;     //镜头的逻辑中心点Y
    CCNode* _followNode;    //跟随的节点
    BOOL _isFollow;         //是否可以开始跟随
}

+(id) cameraWithWidth:(float)width height:(float)height x:(float)x y:(float)y;
-(id) initWithWidth:(float)width height:(float)height x:(float)x y:(float)y;
-(void) setViewpointCenterEase:(CGPoint)position;
-(void) setFollowNode:(CCNode*)followNode;
-(void) unFollowNode;
-(void) onMoveAtTarget;
-(void) onNearTarget;

@property (readwrite) float width; 
@property (readwrite) float height; 
@property (readwrite) float x; 
@property (readwrite) float y; 

@property (readwrite) float curWidth; 
@property (readwrite) float curHeight; 
@property (readwrite) float curX; 
@property (readwrite) float curY; 
@property (readwrite) float centerX; 
@property (readwrite) float centerY; 
@end
